package com.my.admin.config;

import com.my.admin.enmu.ErrorTypeEnum;
import com.my.admin.util.Rest;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author my
 * 异常处理Controller
 */
@RestController
public class NotFoundException implements ErrorController {
    @Override
    public String getErrorPath() {
        return null;
    }

    @RequestMapping("error")
    public Rest error(HttpServletRequest request) {
        return Rest.err(ErrorTypeEnum.ERROR_400);
    }
}
